Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAS Thumbnail operations #150

Merged
merged 10 commits into from
Dec 1, 2023
Merged

AAS Thumbnail operations #150

merged 10 commits into from
Dec 1, 2023

Conversation

zhangzai123
Copy link
Contributor

No description provided.

AAS thumbnail operation

Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
@Test
public void uploadThumbnailToShell() throws IOException {
createDummyAasOnServer(getAas1JSONString());
CloseableHttpResponse getThumbnailResponse = uploadThumbnail(dummyAasId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close the response


@Test
public void getFileFromNotExistElement() throws FileNotFoundException, UnsupportedEncodingException, ClientProtocolException, IOException {
CloseableHttpResponse response = BaSyxHttpTestUtils.executeGetOnURL(BaSyxHttpTestUtils.getThumbnailAccessURL(getURL(), dummyAasId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close the response


@Test
public void deleteNonExistingThumbnail() throws FileNotFoundException, UnsupportedEncodingException, ClientProtocolException, IOException {
CloseableHttpResponse response = BaSyxHttpTestUtils.executeDeleteOnURL(BaSyxHttpTestUtils.getThumbnailAccessURL(getURL(), dummyAasId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close the response

@Override
public ResponseEntity<Resource> getThumbnailAasRepository(Base64UrlEncodedIdentifier aasIdentifier) {
try {
FileInputStream fileInputStream = new FileInputStream(aasRepository.getThumbnail(aasIdentifier.getIdentifier()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close inputstream

throwIfFilePathIsNotValid(aasId, filePath);
}

private static void throwIfFilePathIsNotValid(String aasId, String filePath) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move private methods to bottom of the file

ThumbnailHandler.setNewThumbnail(this, aasId, contentType, filePath);
}

private void updateThumbnailFile(String aasId, String fileName, String contentType, InputStream inputStream, Resource thumbnail) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move private methods to the bottom of the file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, move to thumbnailHandler?

setAssetInformation(aasId, assetInfor);
}

private void deleteThumbnailFile(Resource thumbnail) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to ThumbnailHandle?

ThumbnailHandler.updateThumbnail(this, aasId, contentType, filePath);
}

private String createFile(String aasId, String fileName, InputStream inputStream) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to ThumbnailHandler?

@mateusmolina-iese
Copy link
Member

Approved

@FrankSchnicke FrankSchnicke merged commit bbfdf39 into eclipse-basyx:main Dec 1, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants